<!DOCTYPE html>
<html>
<head>
    <title>{$article.title}</title>
    <meta name="keywords" content="{$site_info.site_seo_keywords|default=''}"/>
    <meta name="description" content="{$site_info.site_seo_description|default=''}">
    <include file="public@head"/>
    <link rel="stylesheet" href="__TMPL__/public/assets/css/list.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/layui/css/layui.css">
    <script src="__TMPL__/public/assets/layui/layui.js"></script>

    <style>
        #article_content img {
            height: auto !important;
            max-width: 100%;
        }

        .file-content img {
            display: block;
            width: 160px;
            margin-top: 32px;
            margin-left: auto;
            margin-right: auto;
        }

        .file-name {
            color: #0b6cbc;
            font-size: 15px;
            font-weight: bold;
            text-align: center;
            margin-left: auto;
            margin-right: auto;
        }

        .btn.btn-download {
            background: #0b6cbc;
            width: 120px;
            color: #fff;
            border-radius: 5px;
            height: 36px;
            line-height: 36px;
            margin: auto;
            margin-top: 10px;
            outline: none;
            cursor: pointer;
            display: block;
        }

        .login-panel {
            width: 300px;
            padding: 16px;
            background: #fff;
        }

        .login-form-user {
            display: block;
            height: 32px;
            width: 280px;
            padding: 0 10px;
            border: solid 1px #e0e0e0;

        }
        .login-form-password {
            display: block;
            height: 32px;
            width: 280px;
            padding: 0 10px;
            margin-top: 16px;
            border: solid 1px #e0e0e0;

        }
        .login-form-user:focus {
            border: solid 1px #0B90C4;
        }
        .login-form-password:focus {
            border: solid 1px #0B90C4;
        }

        .btn-download:active {
            background: #084b83;
        }

        #article_content {
            word-wrap: break-word;
        }
    </style>
    <hook name="before_head_end"/>
</head>
<body class="body-white">

<div class="container shadow">
    <include file="public@nav"/>

    <div class="section clearfix">
        <div class="section-left">
            <div class="news-container" style="margin-top: 0">
                <div class="news-container-header">

                    <a href="{:cmf_url('portal/Download/index')}"><h2>下载中心</h2>
                    </a>

                    <hr/>
                </div>

            </div>

            <div class="news-container">
                <div class="news-container-header">
                    <h2>通知公告</h2>

                    <a href="" class="more">更多</a>

                </div>
                <hr/>
                <ul class="newslist">
                    <portal:articles limit="5" order="post.post_hits DESC"
                                     categoryIds="20">

                        <li style="line-height: 25px;">·<a
                                href="{:cmf_url('portal/Article/index',array('id'=>$vo.id,'cid'=>$vo.category_id))}"
                                target="_blank" title="{$vo['post_title']}">
                            {:sub_title($vo['post_title'],14)}</a></li>
                    </portal:articles>
                </ul>
            </div>
            <div class="news-container">
                <div class="news-container-header"><h2 style="">政策法规</h2><a href=""
                                                                            class="more">更多</a>
                </div>
                <hr/>
                <ul class="newslist">
                    <portal:articles limit="5" order="post.post_hits DESC"
                                     categoryIds="26">
                        <li style="line-height: 25px;">·<a
                                href="{:cmf_url('portal/Article/index',array('id'=>$vo.id,'cid'=>$vo.category_id))}"
                                target="_blank" title="{$vo['post_title']}">
                            {:sub_title($vo['post_title'],14)}</a></li>
                    </portal:articles>
                </ul>
            </div>
        </div>
        <div class="section-right">
            <div class="section-right-header">
                <a href="/">首页</a>-
                <a href="{:url('portal/Download/index')}">下载中心</a>-

            </div>
            <div class="section-content">

                <h1>{$article.title}</h1>
                <h2>上传时间:{:date('Y-m-d',$article.create_time)}&nbsp;&nbsp;来源:{$article.more.source|default="本站"}&nbsp;&nbsp;下载次数：{$article.num}次</h2>
                <script type=text/javascript>
                    function doZoom(size) {
                        document.getElementById('zoom').style.fontSize = size + 'px';
                    }
                </script>
                <div id=zoom class=text>
                    <div class="file-content">
                        <img src="__TMPL__/public/assets/images/file.png">
                    </div>
                    <div class="file-name">
                        {$article.file_name|default=''}
                    </div>
                    <button  class="btn btn-download">下载文件</button>
                </div>

            </div>
        </div>
    </div>
    <div class="login-panel" id="login-panel" style="display: none;">
        <input type="text" class="login-form-user" placeholder="请输入账号">
        <input type="password" class="login-form-password" placeholder="请输入密码">
        <button class="layui-btn" id="login" style="width: 300px;margin-top: 32px;">登录</button>
    </div>
    <script>
        layui.use('layer', function () {
            var $ = layui.jquery, layer = layui.layer;

            $(".btn-download").click(function () {
                $.get("{:url('portal/Download/download',['id'=>$article.id])}", function (res) {
                    if (res.code == 1) {
                        window.location.href = res.url;
                    } else {
                            layer.open({
                                type: 1,
                                title: "下载账号登录",
                                content: $("#login-panel"),

                            })
                    }
                })
            })
            $("#login").click(function () {
                var username = $(".login-form-user").val();
                var password = $(".login-form-password").val();
                if(username == ""){
                    layer.msg('请输入账号')
                    return;
                }
                if(password == ""){
                    layer.msg('请输入密码')
                    return;
                }
                $.post("{:url('portal/Download/login')}",{username:username,password:password},function (res) {
                    if(res.code == 1){
                        layer.closeAll();
                        $(".btn-download").trigger("click");
                    }else {
                        layer.msg(res.msg);
                    }
                })
            })
        });

    </script>

    <include file="public@footer"/>
</div>

<include file="public@scripts"/>

<hook name="before_body_end"/>
</body>
</html>